package com.zyh.file;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class FileDemo2 {
    public static void main(String[] args) {
        File file1 = new File("D:\\Code\\IDEA\\idea_projects\\JavaSE-plus\\day04-code\\src\\com\\zyh\\file\\User.txt");
        File file2 = new File("day04-code/src/com/zyh/file/User.txt");
        System.out.println("file1.getName() = " + file1.getName());
        System.out.println("file2.getName() = " + file2.getName());
        System.out.println("file1.getPath() = " + file1.getPath());
        System.out.println("file2.getPath() = " + file2.getPath());
        System.out.println("file1.getAbsolutePath() = " + file1.getAbsolutePath());
        System.out.println("file2.getAbsolutePath() = " + file2.getAbsolutePath());
        long l = file1.lastModified();
        System.out.println("l = " + l);
        Date time = new Date(l);
        String format = new SimpleDateFormat("yyyy年MM月dd日,HH:mm:ss").format(time);
        System.out.println("format = " + format);
        long length = file1.length();
        System.out.println("length = " + length);
    }
}
